package com.itheima.ydd.mapper;

import com.itheima.ydd.entity.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 菜单表 Mapper 接口
 * </p>
 */
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {
    @Select(" <script>" +
            "SELECT DISTINCT m.* FROM sys_menu m, sys_role_menu rm WHERE m.id = rm.menu_id and  rm.role_id  in "+
            " <foreach collection='strings' open='(' item='id' separator=',' close=')'> #{id}</foreach> AND m.type = 1"+
            " </script>" )
    List<SysMenu> findMenuList(@RequestParam("strings") String[] strings);
}
